<template>
    <div class="content" ref="rightScroll">
        <div class="header">
            <div class="top">
                <i class="iconfont  salesPortal-jizhong"></i>
                <span>{{list.name}}</span>
            </div>
            <div class="bottom">
                <div class="con">
                    <span>{{list.num}}</span>
                    <span>{{list.yield}}</span>
                    <span>{{list.pencent}}%</span>

                </div>
                <div class="bot">
                    <span>不良类别数</span>
                    <span>不良总数</span>
                    <span>不良率</span>
                </div>
            </div>
        </div>
        <div v-for="(item,index) in list.children" :key="index" class="informations" :style="!item.isShow? 'height:100px' : 'height:auto'">
            <div class="operation" v-if="!guSu ? 'display: none' : ''">
                <div class="header-t">
                    <div class="to1">
                        <Icon v-if="item.isShow" size="24" type="ios-cog"/>
                        <Icon v-else size="24" type="ios-cog-outline"/>
                        <!--<i v-if="item.isShow" class="iconfont aa salesPortal-gongxu qtch-jiantouxia icon-dangqianzaixian">1111</i>-->
                        <!--<i v-else class="iconfont salesPortal-gongxu icon-dangqianzaixian"></i>-->
                        <span>{{item.name}}</span>
                    </div>
                    <div class="to2" @click="showHandler(item)">
                        <span >{{item.isShow?"收起":"展开"}}</span>
                        <Icon v-if="item.isShow" color="#0D6BF8" size="24" type="md-arrow-dropup"/>
                        <Icon v-else color="#0D6BF8" size="24" type="md-arrow-dropdown"/>
                        <!--<i class="iconfont salesPortal-xingzhuang594 icon-dangqianzaixian" :class="item.isShow ? 'isShowT' : 'isShowF'"></i>-->
                    </div>
                </div>

                <div class="bottom">
                    <div class="con">
                        <span>{{item.children.length}}</span>
                        <span>{{item.num}}</span>
                        <span style="color:#1dbf62">{{item.pencent}}%</span>

                    </div>
                    <div class="bot">
                        <span>不良类别数</span>
                        <span>不良总数</span>
                        <span>不良率</span>
                    </div>
                </div>
                <div class="border" v-if="item.isShow ? 'display: none' : ''"></div>
            </div>
            <div class="tabInformation" v-if="item.isShow ? 'display: none' : ''">
                <div class="informationList">
                    <div class="information-header"><span>不良类别</span><span>不良数</span><span>不良率</span></div>
                    <div class="information-list" v-for="(i,cindex) in item.children || []" :key="cindex">
                        <span :title="i.name">{{i.name}}</span>
                        <span>{{i.num}}</span>
                        <span>{{i.pencent}}%</span></div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import { Table,Icon } from 'view-design'
    export default {
        name: "rightInfo",
        data() {
            return {
                guSu:false,
            }
        },
        props: ['list'],
        components: {Table},
        mounted(){

        },
        methods:{
            showHandler(item){
                item.isShow = !item.isShow
                this.$forceUpdate()
            }
        }
    }
</script>

<style lang="scss" scoped>
    .content{
        height: 780px;
        overflow-y: auto;
        box-shadow: -4px 0px 10px 0px rgba(139, 139, 139, 0.1);
        border-radius: 3px;
        background: #fff;
        .header{
            width: 390px;
            height: 140px;
            margin: 25px auto 0 auto;
            background: url("~images/defectiveRate/bg.png") no-repeat;
            background-size: 100% 100%;
            border-radius: 3px;
            // padding: 13px;
            .top{
                width: 349px;
                border-bottom: solid 1px #ffffff;
                // opacity: 0.5;
                padding: 4% 2%;
                margin:  0 auto;
                i{
                    width: 24px;
                    height: 24px;
                    background-color: #ffffff;
                    border-radius: 6px;
                    margin-right: 10px;
                    padding: 3px;
                    color: #187bdb;
                }
                span{
                    width: 79px;
                    font-family: MicrosoftYaHei-Bold;
                    font-size: 16px;
                    font-weight: normal;
                    font-stretch: normal;
                    letter-spacing: 2px;
                    color: #ffffff;
                    line-height: 13px;
                }
            }
            .bottom{
                width: 349px;
                margin: 0 auto;
                .con{
                    span{
                        width: 33%;
                        text-align: center;
                        float: left;
                        padding: 2px 0;
                        font-family: MicrosoftYaHei-Bold;
                        font-size: 21px;
                        font-weight: bolder;
                        font-stretch: normal;
                        letter-spacing: 2px;
                        color: #ffffff;
                    }
                }
                .bot{
                    span{
                        width: 33%;
                        text-align: center;
                        float: left;
                        font-family: MicrosoftYaHei;
                        font-size: 14px;
                        font-weight: normal;
                        font-stretch: normal;
                        letter-spacing: 1px;
                        color: #ffffff;
                        opacity: 0.5;
                    }
                }
            }
        }
        .informations{
            width: 82%;
            /* min-height: .7px; */
            /* margin-left: 4%; */
            height: auto;
            // overflow: hidden;
            margin: 0 auto;
            position: relative;
            border-left: 1px #dddddd solid;
            border-radius: 0 0 6px 6px;

            .operation{
                width: 100%;
                height: 77px;
                float: left;
                .header-t{
                    width: 100%;
                    height: 27px;
                    .to1{
                        height: 13px;
                        font-size: 14px;
                        font-weight: normal;
                        font-stretch: normal;
                        letter-spacing: 0;
                        display: inline-block;
                        float: left;
                        color: #525b71;
                        margin-left: 5px;

                        .aa{
                            width: 28px;
                            height: 28px;
                            text-align: center;
                            padding: 4px;
                            line-height: 20px;
                            border-radius: 50%;
                            margin-left: -18px;
                            position: relative;
                            bottom: 5px;
                            background: #187bdb;
                            color: #ffffff;
                            display: inline-block;
                            transform: scale(0.9);
                            -moz-transform:scale(0.9);
                            -o-transform:scale(0.9);
                            -webkit-transform: scale(0.8);
                        }
                        i{
                            width: 28px;
                            height: 28px;
                            text-align: center;
                            padding: 4px;
                            line-height: 20px;
                            color:#187bdb ;
                            background-color: #e7f2fb;
                            border-radius: 50%;
                            margin-left: -18px;
                            position: relative;
                            bottom: 5px;
                            display: inline-block;
                            transform: scale(0.9);
                            -moz-transform:scale(0.9);
                            -o-transform:scale(0.9);
                            -webkit-transform: scale(0.8);
                        }
                        span{
                            margin-left: 11px;
                            font-family: MicrosoftYaHei-Bold;
                            font-size: 14px;
                            font-weight: bold;
                            font-stretch: normal;
                            letter-spacing: 1px;
                            color: #666666;
                        }
                    }
                    .to2{
                        height: 13px;
                        color: red;
                        font-size: 14px;
                        font-weight: normal;
                        font-stretch: normal;
                        letter-spacing: 0;
                        float: right;
                        display: inline-block;
                        color: #525b71;
                        cursor:pointer;
                        margin-left: 5px;
                        span{
                            width: 29px;
                            height: 14px;
                            font-family: MicrosoftYaHei;
                            font-size: 14px;
                            font-weight: normal;
                            font-stretch: normal;
                            letter-spacing: 1px;
                            color: #187bdb;
                            line-height: 26px;
                        }
                    }
                }
                .bottom{
                    width: 349px;
                    margin: 0 auto;
                    .con{
                        span{
                            width: 33%;
                            text-align: center;
                            float: left;
                            padding: 2px 0;
                            font-family: MicrosoftYaHei-Bold;
                            font-size: 21px;
                            overflow: hidden;
                            display: block;
                            font-weight: bolder;
                            font-stretch: normal;
                            /* letter-spacing: 2px; */
                            color: #333333;
                        }
                    }
                    .bot{
                        span{
                            width: 33%;
                            text-align: center;
                            float: left;
                            font-family: MicrosoftYaHei;
                            font-size: 14px;
                            font-weight: normal;
                            font-stretch: normal;
                            letter-spacing: 1px;
                            color: #666666;
                        }
                    }
                }
                .border{
                    width: 346px;
                    height: 2px;
                    border: 1px #dddddd dashed;
                    float: left;
                    margin-left: 4%;
                    margin-top: 25px;
                    opacity: 0.5;
                }
            }

            .production{
                width: 50%;
                height: 77px;
                float: left;
                span:nth-child(1){
                    height: 13px;
                    float: left;
                    font-size: 14px;
                    font-weight: normal;
                    font-stretch: normal;
                    line-height: 77px;
                    letter-spacing: 0;
                    display: block;
                    color: #525b71;
                    margin-left: 5px;
                }
                span:nth-child(2){
                    width: 5px;
                    height: 13px;
                    float: left;
                    font-size: 14px;
                    font-weight: normal;
                    font-stretch: normal;
                    line-height: 77px;
                    letter-spacing: 0;
                    color: #7a849c;
                }
            }

            .tabInformation{
                .informationList{
                    margin: 0 auto;
                    padding: 100px 20px 10px 20px;
                    .information-header{
                        height: 34px;
                        background-color: #cccccc;
                        text-align: center;
                        line-height: 34px;
                        border-radius: 3px;
                        margin-top: 20px;
                        padding-left: 15px;
                        span{
                            width: 33.33%;
                            height: 34px;
                            line-height: 34px;
                            font-size: 14px;
                            display: inline-block;
                            letter-spacing: 0px;
                            float: left;
                            color: #333333;
                            font-weight: bold;
                        }
                    }
                    .information-list{
                        width: 100%;
                        margin: 20px 0;
                        text-align: center;
                        padding-left: 15px;
                        span:nth-child(1){
                            width: 33.33%;
                            font-size: 14px;
                            display: inline-block;
                            font-weight: normal;
                            font-stretch: normal;
                            letter-spacing: 0px;
                            color: #525b71;
                            float: left;
                            text-overflow: ellipsis;
                            overflow: hidden;
                            white-space: nowrap;
                        }
                        span:nth-child(2){
                            width: 33.33%;
                            // font-size: 14px;
                            word-break: break-all;
                            overflow: hidden;
                            font-weight: normal;
                            font-stretch: normal;
                            color: #7a849c;
                            display: inline-block;
                        }
                        span:nth-child(3){
                            width: 33.33%;
                            // font-size: 14px;
                            word-break: break-all;
                            overflow: hidden;
                            font-weight: normal;
                            font-stretch: normal;
                            color: #7a849c;
                            display: inline-block;
                        }
                    }
                }

            }

            .isShowF{
                font-size: 10px;
                color: #0d69f8;
                -webkit-transform: scale(0.4);
                transform: scale(0.4);
                display: inline-block;
                position: relative;
                right: 9px;
                bottom: 2px;
                transform-origin:center center;
            }
            .isShowT{
                font-size: 10px;
                color: #0d69f8;
                -webkit-transform: scale(0.4);
                transform: scale(0.4);
                display: inline-block;
                position: relative;
                right: 9px;
                transform-origin:center center;
                bottom: 2px;
                transform: scale(0.4) rotate(180deg)!important;
                -moz-transform:scale(0.4) rotate(180deg)!important;
                -webkit-transform:scale(0.4) rotate(180deg)!important;
                -o-transform:scale(0.4) rotate(180deg)!important;
            }

        }
        .menu{
            width: 384px;
            margin: 15px auto;
            border-left: solid 1px #dddddd;
            .headera{
                width: 100%;
                height: 27px;
                padding: 0 10px;
                .left{
                    width: 31px;
                    height: 12px;
                    font-family: MicrosoftYaHei-Bold;
                    font-size: 14px;
                    font-weight: normal;
                    font-stretch: normal;
                    letter-spacing: 1px;
                    color: #666666;
                }
                .right{
                    height: 14px;
                    font-family: MicrosoftYaHei;
                    font-size: 14px;
                    font-weight: normal;
                    font-stretch: normal;
                    letter-spacing: 1px;
                    color: #187bdb;
                    float: right;
                    i{
                        font-size: 10px;
                    }
                    .expand{
                        color: red;
                        -webkit-transform: rotate(180deg);
                        -moz-transform: rotate(180deg);
                        -o-transform: rotate(180deg);
                        -ms-transform: rotate(180deg);
                        transform: rotate(180deg);
                    }
                    .close{
                        color: black;
                        -webkit-transform: rotate(180deg);
                        -moz-transform: rotate(180deg);
                        -o-transform: rotate(180deg);
                        -ms-transform: rotate(180deg);
                        transform: rotate(180deg);
                    }
                }
                .con{
                    span{
                        width: 33%;
                        text-align: center;
                        float: left;
                        padding: 10px 0;
                        font-family: MicrosoftYaHei-Bold;
                        font-size: 21px;
                        font-weight: normal;
                        font-stretch: normal;
                        letter-spacing: 2px;
                        color: #333333;
                    }
                }
                .bot{
                    span{
                        width: 33%;
                        text-align: center;
                        float: left;
                        font-family: MicrosoftYaHei;
                        font-size: 14px;
                        font-weight: normal;
                        font-stretch: normal;
                        letter-spacing: 1px;
                        color: #333333;
                        opacity: 0.5;
                    }
                }

            }
            .border{
                width: 346px;
                float: left;
                margin: 18px 5%;
                text-align: center;
                border: dashed 1px #dddddd;
            }
            .meun-content{
                width: 358px;
                height: 335px;
                float: left;
                margin: 0 4%;
                .headers{
                    width: 358px;
                    height: 34px;
                    background-color: #f5f5f5;
                    border-radius: 3px;
                    background: #cccccc;
                    span{
                        width: 45px;
                        height: 14px;
                        font-family: MicrosoftYaHei-Bold;
                        font-size: 14px;
                        font-weight: normal;
                        font-stretch: normal;
                        letter-spacing: 1px;
                        color: #333333;
                    }
                }
            }

        }
    }
</style>
